-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn on and off HSI clock if system clock use MSI clock. #131
Conversation
if ((uTime - s_uLastCalibTime) < 2000) | ||
return true; | ||
|
||
s_uLastCalibTime = uTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for now, but long term we should not use statics in C++ code. This belongs in the parent object (which is either the Catena or "cAdc" class that's embedded. AdcCalibrate should be a private method of the enclosing object, possibly with a friend
class (for the individual sense points, if we decide to have a ADC measurement class so that we write gCatena.Vbus.Read()
instead of the current replication of names).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with merging. Please check my comments, and do what makes sense.
@@ -238,16 +274,30 @@ static bool AdcCalibrate(void) | |||
// return false; | |||
} | |||
|
|||
uTime = millis(); | |||
if ((uTime - s_uLastCalibTime) < 2000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2000
should be a constexpr
defined at the top of the module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will add ADC_CALIBRATE_TIME.
" CR=%x ISR=%x\n", | ||
ADC1->CR, | ||
ADC1->ISR | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These printfs() add a lot of code to the image. We're getting close to needing a macro or something for this. We don't have a lot of flash space. But OK for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added for debugging purpose. I think we don't need right now. I will comment out all debug message.
This is for #125